#!/bin/bash

APP_PATH=$(pwd)  # 替换为您的应用程序路径
source /$APP_PATH/venv/bin/activate

start() {
    echo "start tg_robot"
    python3 TGRobot.py &
}

stop() {
    echo "Stopping tg_robot..."
    pkill -f TGRobot.py
}

restart() {
    stop
    start
}

restart() {
    stop
    start
}

account() {
    rm session_name.session
    python3 account.py
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        restart
        ;;
    account)
        account
        ;;
    *)
        echo "Usage: $0 {start|stop|restart|account}"
        exit 1
        ;;
esac

# 退出虚拟环境
deactivate